package tq.com.tqteacher.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.TextView;

import tq.com.tqteacher.R;

public class TQHShowView extends FrameLayout {
    private TextView titleView;
    private TextView contentView;

    public TQHShowView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initUi(attrs);
    }

    protected void initUi(AttributeSet attrs){
        LayoutInflater.from(getContext()).inflate(R.layout.view_horrizontalshow_layout, this, true);
        titleView = findViewById(R.id.title);
        contentView = findViewById(R.id.content);

        TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.TQHShowView);
        String title = typedArray.getString(R.styleable.TQHShowView_TQHShowView_title);
        typedArray.recycle();
        titleView.setText(title);
    }

    public void setText(String pText){
        contentView.setText(pText);
    }
}
